import { mapSet } from '@/config/mapSet.js'
import markLocation from '@/assets/images/map/marker-icon/mark-location.png'
import * as olProj from 'ol/proj'

export const viewerDefaultConfig = {
  projection: 'EPSG:3857',
  center: olProj.transform(mapSet.center, 'EPSG:4326', 'EPSG:3857'),
  zoom: mapSet.slitezoom,
  maxZoom: mapSet.Max_Zoom,
  minZoom: mapSet.Min_Zoom,
  constrainResolution: true,
  smoothResolutionConstraint:false,

  locationConfig: { // 定位点设置
    show: false,
    type: 'LocationLayer',
    layerProperties: {
      name: 'LocationLayer'
    },
    layerStyle: {
      pointType: 'image',
      style: {
        url: markLocation,
        imageScale: 0.25 // 图片scale
      }
    }
  },
  toolbarConfig: { // 工具栏设置
    show: false,
    type: 'ToolbarControl',
    className: 'ol-toolbar-control1',
    layerProperties: {
      name: 'ToolbarControl'
    },
    toolbarBtnsConfig: { // 工具栏按钮
      zoomIncrease: { // zoom 放大
        show: true,
        label: '放大',
        className: ''
      },
      zoomReduce: { // zoom 缩小
        show: true,
        label: '缩小',
        className: ''
      },
      fullScreen: { // 满屏
        show: false,
        label: '全屏',
        reduceLabel: '退出',
        className: ''
      },
      measuringDistance: { // 测量距离
        show: false,
        label: '测距',
        className: '',
        layerConfig: {
          type: 'DrawShapLayer',
          layerProperties: {
            name: 'DrawShapLayerDistance'
          },
          shapConfig: {
            type: 'MultiLineString'
          },
          labelConfig: {
            show: true
          }
        }
      },
      measuringArea: { // 测量面积
        show: false,
        label: '测面',
        className: '',
        layerConfig: {
          type: 'DrawShapLayer',
          layerProperties: {
            name: 'DrawShapLayerArea'
          },
          shapConfig: {
            type: 'MultiPolygon'
          },
          labelConfig: {
            show: true
          }
        }
      },
      clearSet: {
        show: false,
        label: '清理',
        className: ''
      }
    }
  },
  layers: [], // 主要用于mark ，自定义的layer
  mapLayers: {
    type: 'TileLayer',
    layerProperties: { // 基本的地图道路影像,一般不会更改
      name: '卫星地图影像',
      source: [{
        url: mapSet?.SliteMAP_URL,
        properties: {
          title: '路网',
          id: 'roadOne', // 影像标识
          name: 'TileLayer',
          geometryName: 'TileLayer'
        }
      }],
      properties: {
        title: '路网',
        id: 'roadOne', // 影像标识
        name: 'TileLayer',
        geometryName: 'TileLayer'
      }
    }
  },
  overlayConfig:{ // 用于配置overlay
    id:'overlayId',
    element:document.getElementById('#app'),
    offset:[0,0],
    positioning:'top-left',
    position:mapSet.center // 坐标点
  }
}
